package com.mylike.wechatmanager;

import com.mylike.socket.socket.WebSocketServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


@ComponentScan(basePackages = {"com.mylike"})
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class WechatManagerApplication {

	@RequestMapping("/")
	public ModelAndView index(HttpServletRequest request, HttpServletResponse response){
		ModelAndView mode = new ModelAndView();
		mode.addObject("name", "zhangsan122");


		String contextPath = request.getContextPath();
		String basePath = request.getScheme() + "://" + request.getServerName();
		if(request.getServerPort() != 80) {
			basePath += ":" + request.getServerPort();
		}
		basePath += contextPath;
		mode.addObject("basePath", basePath);

		mode.setViewName("index");
		return mode;
	}

	public static void main(String[] args) {
		SpringApplication.run(WechatManagerApplication.class, args);
	}
}
